Integrand size = 29, antiderivative size = 88 \[ \int \cos ^2(c+d x) \left (A+B \cos (c+d x)+C \cos ^2(c+d x)\right ) \, dx=\frac {1}{8} (4 A+3 C) x+\frac {B \sin (c+d x)}{d}+\frac {(4 A+3 C) \cos (c+d x) \sin (c+d x)}{8 d}+\frac {C \cos ^3(c+d x) \sin (c+d x)}{4 d}-\frac {B \sin ^3(c+d x)}{3 d} \]
1/8*(4*A+3*C)*x+B*sin(d*x+c)/d+1/8*(4*A+3*C)*cos(d*x+c)*sin(d*x+c)/d+1/4*C *cos(d*x+c)^3*sin(d*x+c)/d-1/3*B*sin(d*x+c)^3/d
Time = 0.15 (sec) , antiderivative size = 70, normalized size of antiderivative = 0.80 \[ \int \cos ^2(c+d x) \left (A+B \cos (c+d x)+C \cos ^2(c+d x)\right ) \, dx=\frac {48 A c+36 c C+48 A d x+36 C d x+96 B \sin (c+d x)-32 B \sin ^3(c+d x)+24 (A+C) \sin (2 (c+d x))+3 C \sin (4 (c+d x))}{96 d} \]
(48*A*c + 36*c*C + 48*A*d*x + 36*C*d*x + 96*B*Sin[c + d*x] - 32*B*Sin[c + d*x]^3 + 24*(A + C)*Sin[2*(c + d*x)] + 3*C*Sin[4*(c + d*x)])/(96*d)
Time = 0.45 (sec) , antiderivative size = 88, normalized size of antiderivative = 1.00, number of steps used = 10, number of rules used = 9, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.310, Rules used = {3042, 3502, 3042, 3227, 3042, 3113, 2009, 3115, 24}
Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.
\(\displaystyle \int \cos ^2(c+d x) \left (A+B \cos (c+d x)+C \cos ^2(c+d x)\right ) \, dx\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \int \sin \left (c+d x+\frac {\pi }{2}\right )^2 \left (A+B \sin \left (c+d x+\frac {\pi }{2}\right )+C \sin \left (c+d x+\frac {\pi }{2}\right )^2\right )dx\) |
\(\Big \downarrow \) 3502 |
\(\displaystyle \frac {1}{4} \int \cos ^2(c+d x) (4 A+3 C+4 B \cos (c+d x))dx+\frac {C \sin (c+d x) \cos ^3(c+d x)}{4 d}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \frac {1}{4} \int \sin \left (c+d x+\frac {\pi }{2}\right )^2 \left (4 A+3 C+4 B \sin \left (c+d x+\frac {\pi }{2}\right )\right )dx+\frac {C \sin (c+d x) \cos ^3(c+d x)}{4 d}\) |
\(\Big \downarrow \) 3227 |
\(\displaystyle \frac {1}{4} \left ((4 A+3 C) \int \cos ^2(c+d x)dx+4 B \int \cos ^3(c+d x)dx\right )+\frac {C \sin (c+d x) \cos ^3(c+d x)}{4 d}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \frac {1}{4} \left ((4 A+3 C) \int \sin \left (c+d x+\frac {\pi }{2}\right )^2dx+4 B \int \sin \left (c+d x+\frac {\pi }{2}\right )^3dx\right )+\frac {C \sin (c+d x) \cos ^3(c+d x)}{4 d}\) |
\(\Big \downarrow \) 3113 |
\(\displaystyle \frac {1}{4} \left ((4 A+3 C) \int \sin \left (c+d x+\frac {\pi }{2}\right )^2dx-\frac {4 B \int \left (1-\sin ^2(c+d x)\right )d(-\sin (c+d x))}{d}\right )+\frac {C \sin (c+d x) \cos ^3(c+d x)}{4 d}\) |
\(\Big \downarrow \) 2009 |
\(\displaystyle \frac {1}{4} \left ((4 A+3 C) \int \sin \left (c+d x+\frac {\pi }{2}\right )^2dx-\frac {4 B \left (\frac {1}{3} \sin ^3(c+d x)-\sin (c+d x)\right )}{d}\right )+\frac {C \sin (c+d x) \cos ^3(c+d x)}{4 d}\) |
\(\Big \downarrow \) 3115 |
\(\displaystyle \frac {1}{4} \left ((4 A+3 C) \left (\frac {\int 1dx}{2}+\frac {\sin (c+d x) \cos (c+d x)}{2 d}\right )-\frac {4 B \left (\frac {1}{3} \sin ^3(c+d x)-\sin (c+d x)\right )}{d}\right )+\frac {C \sin (c+d x) \cos ^3(c+d x)}{4 d}\) |
\(\Big \downarrow \) 24 |
\(\displaystyle \frac {1}{4} \left ((4 A+3 C) \left (\frac {\sin (c+d x) \cos (c+d x)}{2 d}+\frac {x}{2}\right )-\frac {4 B \left (\frac {1}{3} \sin ^3(c+d x)-\sin (c+d x)\right )}{d}\right )+\frac {C \sin (c+d x) \cos ^3(c+d x)}{4 d}\) |
(C*Cos[c + d*x]^3*Sin[c + d*x])/(4*d) + ((4*A + 3*C)*(x/2 + (Cos[c + d*x]* Sin[c + d*x])/(2*d)) - (4*B*(-Sin[c + d*x] + Sin[c + d*x]^3/3))/d)/4
3.3.92.3.1 Defintions of rubi rules used
Int[sin[(c_.) + (d_.)*(x_)]^(n_), x_Symbol] :> Simp[-d^(-1) Subst[Int[Exp and[(1 - x^2)^((n - 1)/2), x], x], x, Cos[c + d*x]], x] /; FreeQ[{c, d}, x] && IGtQ[(n - 1)/2, 0]
Int[((b_.)*sin[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> Simp[(-b)*Cos[c + d* x]*((b*Sin[c + d*x])^(n - 1)/(d*n)), x] + Simp[b^2*((n - 1)/n) Int[(b*Sin [c + d*x])^(n - 2), x], x] /; FreeQ[{b, c, d}, x] && GtQ[n, 1] && IntegerQ[ 2*n]
Int[((b_.)*sin[(e_.) + (f_.)*(x_)])^(m_)*((c_) + (d_.)*sin[(e_.) + (f_.)*(x _)]), x_Symbol] :> Simp[c Int[(b*Sin[e + f*x])^m, x], x] + Simp[d/b Int [(b*Sin[e + f*x])^(m + 1), x], x] /; FreeQ[{b, c, d, e, f, m}, x]
Int[((a_.) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_.)*((A_.) + (B_.)*sin[(e_.) + (f_.)*(x_)] + (C_.)*sin[(e_.) + (f_.)*(x_)]^2), x_Symbol] :> Simp[(-C)*Co s[e + f*x]*((a + b*Sin[e + f*x])^(m + 1)/(b*f*(m + 2))), x] + Simp[1/(b*(m + 2)) Int[(a + b*Sin[e + f*x])^m*Simp[A*b*(m + 2) + b*C*(m + 1) + (b*B*(m + 2) - a*C)*Sin[e + f*x], x], x], x] /; FreeQ[{a, b, e, f, A, B, C, m}, x] && !LtQ[m, -1]
Time = 3.83 (sec) , antiderivative size = 63, normalized size of antiderivative = 0.72
method | result | size |
parallelrisch | \(\frac {24 \left (A +C \right ) \sin \left (2 d x +2 c \right )+8 B \sin \left (3 d x +3 c \right )+3 \sin \left (4 d x +4 c \right ) C +72 B \sin \left (d x +c \right )+48 \left (A +\frac {3 C}{4}\right ) x d}{96 d}\) | \(63\) |
risch | \(\frac {x A}{2}+\frac {3 C x}{8}+\frac {3 B \sin \left (d x +c \right )}{4 d}+\frac {\sin \left (4 d x +4 c \right ) C}{32 d}+\frac {B \sin \left (3 d x +3 c \right )}{12 d}+\frac {\sin \left (2 d x +2 c \right ) A}{4 d}+\frac {\sin \left (2 d x +2 c \right ) C}{4 d}\) | \(82\) |
derivativedivides | \(\frac {C \left (\frac {\left (\cos ^{3}\left (d x +c \right )+\frac {3 \cos \left (d x +c \right )}{2}\right ) \sin \left (d x +c \right )}{4}+\frac {3 d x}{8}+\frac {3 c}{8}\right )+\frac {B \left (2+\cos ^{2}\left (d x +c \right )\right ) \sin \left (d x +c \right )}{3}+A \left (\frac {\cos \left (d x +c \right ) \sin \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )}{d}\) | \(84\) |
default | \(\frac {C \left (\frac {\left (\cos ^{3}\left (d x +c \right )+\frac {3 \cos \left (d x +c \right )}{2}\right ) \sin \left (d x +c \right )}{4}+\frac {3 d x}{8}+\frac {3 c}{8}\right )+\frac {B \left (2+\cos ^{2}\left (d x +c \right )\right ) \sin \left (d x +c \right )}{3}+A \left (\frac {\cos \left (d x +c \right ) \sin \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )}{d}\) | \(84\) |
parts | \(\frac {A \left (\frac {\cos \left (d x +c \right ) \sin \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )}{d}+\frac {B \left (2+\cos ^{2}\left (d x +c \right )\right ) \sin \left (d x +c \right )}{3 d}+\frac {C \left (\frac {\left (\cos ^{3}\left (d x +c \right )+\frac {3 \cos \left (d x +c \right )}{2}\right ) \sin \left (d x +c \right )}{4}+\frac {3 d x}{8}+\frac {3 c}{8}\right )}{d}\) | \(89\) |
norman | \(\frac {\left (\frac {A}{2}+\frac {3 C}{8}\right ) x +\left (2 A +\frac {3 C}{2}\right ) x \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\left (2 A +\frac {3 C}{2}\right ) x \left (\tan ^{6}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\left (3 A +\frac {9 C}{4}\right ) x \left (\tan ^{4}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\left (\frac {A}{2}+\frac {3 C}{8}\right ) x \left (\tan ^{8}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )-\frac {\left (4 A -8 B +5 C \right ) \left (\tan ^{7}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{4 d}+\frac {\left (4 A +8 B +5 C \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{4 d}-\frac {\left (12 A -40 B -9 C \right ) \left (\tan ^{5}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{12 d}+\frac {\left (12 A +40 B -9 C \right ) \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{12 d}}{\left (1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )^{4}}\) | \(209\) |
1/96*(24*(A+C)*sin(2*d*x+2*c)+8*B*sin(3*d*x+3*c)+3*sin(4*d*x+4*c)*C+72*B*s in(d*x+c)+48*(A+3/4*C)*x*d)/d
Time = 0.27 (sec) , antiderivative size = 65, normalized size of antiderivative = 0.74 \[ \int \cos ^2(c+d x) \left (A+B \cos (c+d x)+C \cos ^2(c+d x)\right ) \, dx=\frac {3 \, {\left (4 \, A + 3 \, C\right )} d x + {\left (6 \, C \cos \left (d x + c\right )^{3} + 8 \, B \cos \left (d x + c\right )^{2} + 3 \, {\left (4 \, A + 3 \, C\right )} \cos \left (d x + c\right ) + 16 \, B\right )} \sin \left (d x + c\right )}{24 \, d} \]
1/24*(3*(4*A + 3*C)*d*x + (6*C*cos(d*x + c)^3 + 8*B*cos(d*x + c)^2 + 3*(4* A + 3*C)*cos(d*x + c) + 16*B)*sin(d*x + c))/d
Leaf count of result is larger than twice the leaf count of optimal. 197 vs. \(2 (76) = 152\).
Time = 0.17 (sec) , antiderivative size = 197, normalized size of antiderivative = 2.24 \[ \int \cos ^2(c+d x) \left (A+B \cos (c+d x)+C \cos ^2(c+d x)\right ) \, dx=\begin {cases} \frac {A x \sin ^{2}{\left (c + d x \right )}}{2} + \frac {A x \cos ^{2}{\left (c + d x \right )}}{2} + \frac {A \sin {\left (c + d x \right )} \cos {\left (c + d x \right )}}{2 d} + \frac {2 B \sin ^{3}{\left (c + d x \right )}}{3 d} + \frac {B \sin {\left (c + d x \right )} \cos ^{2}{\left (c + d x \right )}}{d} + \frac {3 C x \sin ^{4}{\left (c + d x \right )}}{8} + \frac {3 C x \sin ^{2}{\left (c + d x \right )} \cos ^{2}{\left (c + d x \right )}}{4} + \frac {3 C x \cos ^{4}{\left (c + d x \right )}}{8} + \frac {3 C \sin ^{3}{\left (c + d x \right )} \cos {\left (c + d x \right )}}{8 d} + \frac {5 C \sin {\left (c + d x \right )} \cos ^{3}{\left (c + d x \right )}}{8 d} & \text {for}\: d \neq 0 \\x \left (A + B \cos {\left (c \right )} + C \cos ^{2}{\left (c \right )}\right ) \cos ^{2}{\left (c \right )} & \text {otherwise} \end {cases} \]
Piecewise((A*x*sin(c + d*x)**2/2 + A*x*cos(c + d*x)**2/2 + A*sin(c + d*x)* cos(c + d*x)/(2*d) + 2*B*sin(c + d*x)**3/(3*d) + B*sin(c + d*x)*cos(c + d* x)**2/d + 3*C*x*sin(c + d*x)**4/8 + 3*C*x*sin(c + d*x)**2*cos(c + d*x)**2/ 4 + 3*C*x*cos(c + d*x)**4/8 + 3*C*sin(c + d*x)**3*cos(c + d*x)/(8*d) + 5*C *sin(c + d*x)*cos(c + d*x)**3/(8*d), Ne(d, 0)), (x*(A + B*cos(c) + C*cos(c )**2)*cos(c)**2, True))
Time = 0.23 (sec) , antiderivative size = 77, normalized size of antiderivative = 0.88 \[ \int \cos ^2(c+d x) \left (A+B \cos (c+d x)+C \cos ^2(c+d x)\right ) \, dx=\frac {24 \, {\left (2 \, d x + 2 \, c + \sin \left (2 \, d x + 2 \, c\right )\right )} A - 32 \, {\left (\sin \left (d x + c\right )^{3} - 3 \, \sin \left (d x + c\right )\right )} B + 3 \, {\left (12 \, d x + 12 \, c + \sin \left (4 \, d x + 4 \, c\right ) + 8 \, \sin \left (2 \, d x + 2 \, c\right )\right )} C}{96 \, d} \]
1/96*(24*(2*d*x + 2*c + sin(2*d*x + 2*c))*A - 32*(sin(d*x + c)^3 - 3*sin(d *x + c))*B + 3*(12*d*x + 12*c + sin(4*d*x + 4*c) + 8*sin(2*d*x + 2*c))*C)/ d
Time = 0.29 (sec) , antiderivative size = 70, normalized size of antiderivative = 0.80 \[ \int \cos ^2(c+d x) \left (A+B \cos (c+d x)+C \cos ^2(c+d x)\right ) \, dx=\frac {1}{8} \, {\left (4 \, A + 3 \, C\right )} x + \frac {C \sin \left (4 \, d x + 4 \, c\right )}{32 \, d} + \frac {B \sin \left (3 \, d x + 3 \, c\right )}{12 \, d} + \frac {{\left (A + C\right )} \sin \left (2 \, d x + 2 \, c\right )}{4 \, d} + \frac {3 \, B \sin \left (d x + c\right )}{4 \, d} \]
1/8*(4*A + 3*C)*x + 1/32*C*sin(4*d*x + 4*c)/d + 1/12*B*sin(3*d*x + 3*c)/d + 1/4*(A + C)*sin(2*d*x + 2*c)/d + 3/4*B*sin(d*x + c)/d
Time = 1.44 (sec) , antiderivative size = 81, normalized size of antiderivative = 0.92 \[ \int \cos ^2(c+d x) \left (A+B \cos (c+d x)+C \cos ^2(c+d x)\right ) \, dx=\frac {A\,x}{2}+\frac {3\,C\,x}{8}+\frac {A\,\sin \left (2\,c+2\,d\,x\right )}{4\,d}+\frac {B\,\sin \left (3\,c+3\,d\,x\right )}{12\,d}+\frac {C\,\sin \left (2\,c+2\,d\,x\right )}{4\,d}+\frac {C\,\sin \left (4\,c+4\,d\,x\right )}{32\,d}+\frac {3\,B\,\sin \left (c+d\,x\right )}{4\,d} \]